package com.lw;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * 变量、常量
 */
public class StaticValue {

    //窗口大小
    public static final int WIDTH = 800;
    public static final int HEIGHT = 600;


    public static BufferedImage bg = null;//背景
    public static BufferedImage bg2 = null;

    public static BufferedImage jump_L = null;//朝左跳跃图片
    public static BufferedImage jump_R = null;
    public static BufferedImage stand_L = null;//朝左站立图片
    public static BufferedImage stand_R = null;

    public static BufferedImage tower = null;//城堡图片
    public static BufferedImage gan = null;//旗杆

    //障碍物
    public static List<BufferedImage> obstacle = new ArrayList<>();

    public static List<BufferedImage> run_L = new ArrayList<>();//马里奥朝左跑
    public static List<BufferedImage> run_R = new ArrayList<>();

    public static List<BufferedImage> mogu = new ArrayList<>();//保存了两张图片，正常、死亡
    public static List<BufferedImage> flower = new ArrayList<>();//食人花张嘴、闭嘴

    //路径前缀
    public static String path = System.getProperty("user.dir")+"/src/images/";

    /**
     * 初始化
     */
    public static void init(){
        try {
            //加载背景图片
            bg = ImageIO.read(new File(path+"bg.png"));
            bg2 = ImageIO.read(new File(path+"bg2.png"));

            //马里奥站立图片
            stand_L = ImageIO.read(new File(path+"stand_L.png"));
            stand_R = ImageIO.read(new File(path+"stand_R.png"));

            jump_L = ImageIO.read(new File(path+"stand_L.png"));
            jump_R = ImageIO.read(new File(path+"stand_R.png"));

            //马里奥朝左跑
            run_L.add(ImageIO.read(new File(path+"stand_L.png")));
            run_L.add(ImageIO.read(new File(path+"stand_L.png")));

            run_R.add(ImageIO.read(new File(path+"stand_R.png")));
            run_R.add(ImageIO.read(new File(path+"stand_R.png")));
//
//            //城堡
//            tower = ImageIO.read(new File(path+"tower.png"));
//
//            //旗杆
//            gan = ImageIO.read(new File(path+"gan.png"));
//
//            //障碍物
            obstacle.add(ImageIO.read(new File(path+"brick.png")));//砖块
            obstacle.add(ImageIO.read(new File(path+"brick2.png")));//不可破坏的砖块
            obstacle.add(ImageIO.read(new File(path+"flag.png")));//旗子
            obstacle.add(ImageIO.read(new File(path+"soil_up.png")));//地面上层
            obstacle.add(ImageIO.read(new File(path+"soil_base.png")));//地面下层

            //水管
            obstacle.add(ImageIO.read(new File(path+"pipe1.png")));
            obstacle.add(ImageIO.read(new File(path+"pipe2.png")));
            obstacle.add(ImageIO.read(new File(path+"pipe3.png")));
            obstacle.add(ImageIO.read(new File(path+"pipe4.png")));
//
//            //蘑菇敌人
//            mogu.add(ImageIO.read(new File(path+"mogu1.png")));
//            mogu.add(ImageIO.read(new File(path+"mogu2.png")));
//            mogu.add(ImageIO.read(new File(path+"mogu3.png")));
//
//            //食人花
//            flower.add(ImageIO.read(new File(path+"flower1.png")));
//            flower.add(ImageIO.read(new File(path+"flower2.png")));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

}
